on public_operator_1
on operator me, op
  case op of
    #= : return me.CompareEq
    #<> : return me.CompareNe
    #> : return me.CompareGt
    #< : return me.CompareLt
    #>= : return me.CompareGe
    #<= : return me.CompareLe
    #+ : return me.op_plus
    #- : return me.op_minus
    #* : return me.op_multiply
    #/ : return me.op_div
    #& : return me.StringConcat
    #mod : return me.op_mod
    #and : return me.op_and
    #or : return me.op_or
    #not : return me.op_not
    otherwise: return void
  end case
end

on public_CompareEq_2
on CompareEq me, x,y
  return x=y
end

on public_CompareNe_2
on CompareNe me, x,y
  return x<>y
end

on public_CompareGt_2
on CompareGt me, x,y
  return x>y
end

on public_CompareLt_2
on CompareLt me, x,y
  return x<y
end

on public_CompareGe_2
on CompareGe me, x,y
  return x>=y
end

on public_CompareLe_2
on CompareLe me, x,y
  return x<=y
end


on public_op_plus_2  
on plus me, x,y
  return x+y
end


on public_op_minus_2  
on minus me, x,y
  return x-y
end


on public_op_multiply_2  
on times me, x,y
  return x*y
end


on public_op_div_2  
on div me, x,y
  return x/y
end

on public_op_mod_2
on modulo me, x,y
  return x mod y
end

on public_op_and_2
on op_and me, x,y
  return x and y
end

on public_op_or_2
on op_or me, x,y
  return x or y
end

on public_op_not_1
on op_not me, x
  return not x
end

on public_StringConcat_2  
on StringConcat me, x,y
  return x & y
end


on public_GetAt_2
on List_GetAt me, x,y
  return x.getat(y)
end

on public_Call_1
on CallCommand me,lst
  hnd = lst.head
  inst = lst.tail.head
  params = me.List[ lst.tail.tail ]
  return script("scrLambdaFunction").invokeHandler(hnd,inst,params)
end

-- Side effects --
on public_Add_2
on List_Add me, lst,x
  lst.add(x)
end

-- Side effects --
on public_AddAll_2
on List_AddAll me, dest,src
  repeat with e in src
    dest.add(e)
  end repeat
end


on public_sin_1
on fn_sin me, x
  return sin(x)
end

on public_cos_1
on fn_cos me, x
  return cos(x)
end

on public_atan_1
on fn_atan me, x
  return atan(x)
end

on public_Length_1
on string_length me, s
  return s.length
end

on public_List_1  
on CreateLinearList me, immList
  return ListHelper(immList, list() )
end

on ListHelper immList,lst
  if immList.count = 0 then return lst
  lst.add(immList.head)
  return ListHelper(immList.tail,lst)
end

on public_PropList_1  
on CreatePropList me, immList
  return PropListHelper(immList, propList() )
end

on PropListHelper immList,lst
  if immList.count = 0 then return lst
  if immList.tail.count = 0 then return lst
  lst.addProp(immList.head, immList.tail.head)
  return PropListHelper(immList.tail.tail,lst)
end 

on public_charToNum_1
on pCharToNum me ,x
  return charToNum(x)
end

on public_numToChar_1
on pNumToChar me ,x
  return numToChar(x)
end